package com.eastfair.enums;

import lombok.Getter;

/**
 * redis key公共枚举
 * @ClassName RedisKeyEnum
 * @Description TODO
 * @Author liuxiaobai
 * @Date 2021/8/17 11:25 上午
 * @Version 1.0
 */
@Getter
public enum RedisKeyEnum {
    /**
     * im对话列表 存储类型为set(对话唯一code) 替换域为projectId 项目隔离
     */
    IM_DIALOG("im对话列表","IM_DIALOG_%s",-1L),
    /**
     * 内容邮件配置缓存
     * projectId
     */
    THIRD_PART_CONFIG_EMAIL_CONTENT("内容邮件配置缓存","THIRD_PART_CONFIG_EMAIL_CONTENT_%s",600L),
    /**
     * 验证码邮件配置缓存 邮件验证码考虑用户可能收不到某个服务商邮件而重复获取，所以多个服务商轮流使用
     * projectId、email
     * 60*60*24 一天
     */
    THIRD_PART_CONFIG_EMAIL_CODE("验证码邮件配置缓存","THIRD_PART_CONFIG_EMAIL_CODE_%s_%s",86400L),
    /**
     * 短信配置缓存
     * projectId
     */
    THIRD_PART_CONFIG_SMS("短信配置缓存","THIRD_PART_CONFIG_SMS_%s",600L),
    /**
     * im配置缓存
     * projectId
     */
    THIRD_PART_CONFIG_IM("im配置缓存","THIRD_PART_CONFIG_IM_%s",600L),
    /**
     * 极光配置缓存
     * projectId
     */
    THIRD_PART_CONFIG_JPUSH("极光配置缓存","THIRD_PART_CONFIG_JPUSH_%s",600L),
    /**
     * 项目级别pv - zSet内key为subjectId
     * 替换域projectId、subjectType
     */
    PV_PROJECT("项目级pv","PV_PROJECT_%s_%s",-1L),
    /**
     * 项目级别uv - hyperLogLog 替换域projectId、subjectType、subjectId
     */
    UV_PROJECT("项目级uv","UV_PROJECT_%s_%s_%s",-1L),
    /**
     * 展会级别pv - zSet内key为subjectId 替换域exhibitionId、subjectType
     */
    PV_EXHIBITION("展会级pv","PV_EXHIBITION_%s_%s",-1L),
    /**
     * 展会级别uv - hyperLogLog 替换域exhibitionId、subjectType、subjectId
     */
    UV_EXHIBITION("展会级uv","UV_EXHIBITION_%s_%s_%s",-1L),
    /**
     * 收藏数
     * zSet内key为subjectId 替换域exhibitionId、subjectType
     */
    COLLECTION_NUM_EXHIBITION("收藏数","COLLECTION_NUM_EXHIBITION_%s_%s",-1L),
    ;

    /**
     * 描述
     */
    private final String desc;
    /**
     * redis key
     */
    private final String key;
    /**
     * 过期时间 秒
     */
    private final Long second;

    RedisKeyEnum(String desc,String key,Long second) {
        this.desc = desc;
        this.key = key;
        this.second = second;
    }
}
